package net.runsystem.magiccloud.adapter;

import net.runsystem.magiccloud.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class EcoAdapter extends ArrayAdapter<MenuItem> {

	public EcoAdapter(Context context) {
		super(context, 0);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(getContext()).inflate(
					R.layout.sc07_list_item, null);
		}
		ImageView icon = (ImageView) convertView
				.findViewById(R.id.sc07_list_item_img);

		// Log.e("EcoAdapter", "  resId: " + getItem(position).resId);

		icon.setImageResource(getItem(position).resId);

		TextView title = (TextView) convertView
				.findViewById(R.id.sc07_list_item_txt);
		title.setText(getItem(position).name);

		return convertView;
	}
}
